using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PATREFERRALMap : EntityTypeConfiguration<SO_PATREFERRAL>
    {
        public SO_PATREFERRALMap()
        {
            // Primary Key
            this.HasKey(t => new { t.id, t.REFERRAL_TYPE, t.Physician, t.Internal_Physician });

            // Properties
            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Patient)
                .HasMaxLength(110);

            this.Property(t => t.REFERRAL_TYPE)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Physician)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.Internal_Physician)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.External_Physician)
                .HasMaxLength(50);

            this.Property(t => t.Diagnosis)
                .HasMaxLength(50);

            this.Property(t => t.Note)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("SO_PATREFERRAL");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.Patient).HasColumnName("Patient");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.REFERRAL_TYPE).HasColumnName("REFERRAL_TYPE");
            this.Property(t => t.Physician).HasColumnName("Physician");
            this.Property(t => t.Internal_Physician).HasColumnName("Internal_Physician");
            this.Property(t => t.External_Physician).HasColumnName("External_Physician");
            this.Property(t => t.Diagnosis).HasColumnName("Diagnosis");
            this.Property(t => t.Note).HasColumnName("Note");
        }
    }
}
